From 3b8541a8c4c3cc197aa6e624ae0f9d766afd757e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 25 Dec 2007 04:04:21 +0000 Subject: [PATCH] When popping up a menu from a treeview cell, use the time and button 2007-12-24 Matthias Clasen * gtk/gtkcombobox.c: When popping up a menu from a treeview cell, use the time and button information from the event. (#504901, Peter Bloomfield) svn path=/trunk/; revision=19234 --- ChangeLog | 6 ++++++ gtk/gtkcombobox.c | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a84350f229..5ac91e6461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-12-24 Matthias Clasen + + * gtk/gtkcombobox.c: When popping up a menu from a treeview cell, + use the time and button information from the event. (#504901, + Peter Bloomfield) + 2007-12-23 Cody Russell * gdk/win32/gdkevents-win32.c (show_window_recurse): Check that diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index a8e4949d8a..741bee258d 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -104,6 +104,8 @@ struct _GtkComboBoxPrivate guint reordered_id; guint changed_id; guint popup_idle_id; + guint activate_button; + guint32 activate_time; guint scroll_timer; guint resize_idle_id; @@ -1859,7 +1861,9 @@ gtk_combo_box_real_popup (GtkComboBox *combo_box) if (GTK_IS_MENU (combo_box->priv->popup_widget)) { - gtk_combo_box_menu_popup (combo_box, 0, 0); + gtk_combo_box_menu_popup (combo_box, + combo_box->priv->activate_button, + combo_box->priv->activate_time); return; } @@ -5380,6 +5384,8 @@ popup_idle (gpointer data) gtk_combo_box_popup (combo_box); combo_box->priv->popup_idle_id = 0; + combo_box->priv->activate_button = 0; + combo_box->priv->activate_time = 0; return FALSE; } @@ -5415,7 +5421,18 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable, */ if (combo_box->priv->is_cell_renderer && combo_box->priv->cell_view && !combo_box->priv->tree_view) - combo_box->priv->popup_idle_id = gdk_threads_add_idle (popup_idle, combo_box); + { + if (event && event->type == GDK_BUTTON_PRESS) + { + GdkEventButton *event_button = (GdkEventButton *)event; + + combo_box->priv->activate_button = event_button->button; + combo_box->priv->activate_time = event_button->time; + } + + combo_box->priv->popup_idle_id = + gdk_threads_add_idle (popup_idle, combo_box); + } } -- 2.30.2